//// 转化rem单位
(function(doc, win) {
	var docEl = doc.documentElement,
		resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
		recalc = function() {
			var clientWidth = docEl.clientWidth;
			if (!clientWidth) return;
			if (clientWidth >= 750) {
				docEl.style.fontSize = '100px';
			} else {
				docEl.style.fontSize = 100 * (clientWidth / 750) + 'px';
			}
			var html = document.getElementsByTagName('html')[0];
			var settedFs = settingFs = parseInt(100 * (clientWidth / 750));
			var whileCount = 0;
			while (true) {
				var realFs = parseInt(window.getComputedStyle(html).fontSize);
				var delta = realFs - settedFs;
				//不相等
				if (Math.abs(delta) >= 1) {
					if (delta > 0)
						settingFs--;
					else
						settingFs++;
					html.setAttribute('style', 'font-size:' + settingFs + 'px!important');
				} else
					break;
				if (whileCount++ > 100)
					break
			}
		};
	if (!doc.addEventListener) return;
	win.addEventListener(resizeEvt, recalc, false);
	doc.addEventListener('DOMContentLoaded', recalc, false);
})(document, window);


//通用弹框
function DoAlertCommon(msg, lastHandler) {
	$("#AlertBlock").html(msg);
	$("#AlertBlock").fadeIn();
	//   $("body").css("opacity", 0.8);
	setTimeout(function() {
		$("#AlertBlock").fadeOut();
		$("body").css("opacity", 1);
		if (typeof(lastHandler) != undefined) {
			lastHandler();
		}
	}, 2000);
}

//增加iconfont资源
// document.write('<link rel="stylesheet" href="http://at.alicdn.com/t/font_651029_50gzbmnr9eq.css">');


//document.write('<script src="https://www.w3cways.com/demo/vconsole/vconsole.min.js?v=2.2.0"><\/script>');




//判断是手机还是pc
var isPc = "";

function client() {
	if ((/AppleWebKit.*mobile/i.test(navigator.userAgent) || (
			/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/
			.test(navigator.userAgent)))) {
		isPc = false;
	} else {
		isPc = true;
	}

}
client();



function GetRequest() {
	var url = location.search; //获取url中含"?"符后的字串
	var theRequest = new Object();
	if (url.indexOf("?") != -1) {
		var str = url.substr(1);
		strs = str.split("&");
		for (var i = 0; i < strs.length; i++) {
			theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
		}
	}
	return theRequest;
}
Request = GetRequest();


//解决安卓点击input不回弹的问题
function resolveInput(objId) {
	if (/Android/gi.test(navigator.userAgent)) {
		var inp = document.querySelector(objId);
		var bodyHeight = document.body.offsetHeight;
		inp.onclick = function(ev) {
			document.querySelector('body').style.height = '9999px';
			setTimeout(function() {
				document.body.scrollTop = document.documentElement.scrollTop = inp.getBoundingClientRect().top + pageYOffset - 5;
			}, 50);
			window.addEventListener('touchmove', fn, false);
		}

		inp.onblur = function() {
			window.scroll(0, 0)
			document.querySelector('body').style.height = "auto"
			document.querySelector('body').removeAttribute('style')
			window.removeEventListener('touchmove', fn, false)
		}
		//触摸取消blur
		function fn(ev) {
			var _target = ev.target || ev.srcElement;
			if (_target.nodeName != 'INPUT') {
				inp.blur();
			}
			ev.preventDefault()
		};
	}
}
